<script type="text/javascript">
jQuery(function($){
    $(document.profile).validation();
})
</script>
<form name="profile" method="post" class="profile">
<div class="clearfix textline">
<label>邮箱：</label>
<input type="text" class="text" name="email" value="<?php echo $member->email;?>" readonly="readonly" />
</div>
<div class="clearfix textline">
<label>昵称：</label>
<input type="text" class="text" name="mnick" value="<?php echo $member->mnick;?>" />
</div>
<!--<div class="clearfix textline">
<label>性别：</label>
<label class="radio"><input type="radio" name="sex" value="1"<?php if($member->sex==1) echo ' checked="checked"';?> />男</label>
<label class="radio"><input type="radio" name="sex" value="2"<?php if($member->sex==2) echo ' checked="checked"';?> />女</label>
<label class="radio"><input type="radio" name="sex" value="0"<?php if($member->sex==0) echo ' checked="checked"';?> />保密</label>
</div>
<div class="clearfix textline">
<label>电话：</label>
<input type="text" class="text" name="phone" value="<?php echo $member->phone;?>" />
</div>
<div class="clearfix textline">
<label>QQ：</label>
<input type="text" class="text" name="qq" value="<?php echo $member->qq;?>" />
</div>
<div class="clearfix textline">
<label>通讯地址：</label>
<input type="text" class="text" name="address" value="<?php echo $member->address;?>" />
</div>-->
<div class="clearfix textline">
<label>新密码：</label>
<input type="password" placeholder="不修改密码请留空" class="text" name="mpwd" />
</div>
<div class="clearfix textline">
<label>确认密码：</label>
<input type="password" class="text" name="rmpwd" />
</div>
<div class="clearfix textline">
<label>当前密码：</label>
<input type="password" class="text" required="required" placeholder="填入密码以确认修改" name="oldpwd" />
</div>
<div class="submitline">
    <input type="submit" class="ani button" name="submit" value="更新资料" />
</div>
</form>
<script type="text/javascript" >
function insertImage(field,files){
    var images=[];
    if(field.value){
        images=field.value.split(',');
    }
    for(var i=0;i<files.files.length;i++){
        if(!in_array(images,files.files[i].url)){
            images.push(files.files[i].url);
            renderfile(files.files[i],field);
        }else{
            tip('图片 '+ files.files[i].name +' 已添加过了',1,2);
        }
    }
    field.value=images.join(',');
}
function renderfile(file,field){
    $(field).before('<div class="imageview"><input type="hidden" name="image[]" value="'+file.url+'" /><img src="'+file.thumbnailUrl+'" alt=""/><a href="javascript:" class="ibtn defaultibtn" onclick="setDefault(this)">默认</a><a href="javascript:" class="ibtn" onclick="removeImg(this)">移除</a></div>');
    if(document.workpub.imagedefault.value==''){
        document.workpub.imagedefault.value=file.url;
        $('.imageviewbox .imageview').eq(0).addClass('default');
    }
}
function in_array(arr,value){
    for(var i=0;i<arr.length;i++){
        if(value==arr[i]){
            return true;
        }
    }
    return false;
}
function setDefault(obj){
    var view=$(obj).parents('.imageview').eq(0);
    $('.imageviewbox .imageview').removeClass('default');
    view.addClass('default');
}
function removeImg(obj){
    var view=$(obj).parents('.imageview').eq(0);
    if(confirm('您确定移除此图片？')){
        var isdefault=false;
        if(view.is('.default')){
            isdefault=true;
        }
        view.remove();
        setDefault($('.imageviewbox .defaultibtn').eq(0));
    }
}
</script>